<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see HomeController
 */
class HomeController extends BaseController
{

    /**
     * collectList
     * @uri /home/collect-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"last_id":"E1CC09102F1DD583"}
     * @response {"success":true,"statusCode":200,"result":{"total_count":2,"page_size":20,"page":1,"list":[{"id":"00KF3FHQABQOQSU8HQ1HM6ZJ","user_id":"00K6R8O5C6SPAIDSTALCF5GJ","article_id":"00KDTRSSL6RF5UF49UH0OFYK","is_choice":0,"is_deleted":0,"is_public":1,"is_shield":0,"created_at":1606790559,"target_type":2,"content":"\u53ef\u60dc\u8fd1\u6bb5\u65f6\u95f4\u5370\u5ea6\u7684\u79cd\u79cd\u884c\u4e3a\u5145\u5206\u53cd\u6620\u4e86\u4ed6\u4eec\u5e76\u6ca1\u6709\u8fd9\u79cd\u610f\u8bc6","selected":"\u5370\u5ea6\u653f\u5ba2\u8981\u653e\u4e0b\u653f\u6cbb\u6210\u89c1\u548c\u5730\u7f18\u91ce\u5fc3\uff0c\u5fc3\u5e73\u6c14\u548c\u4e0e\u4e2d\u56fd\u4eba\u505a\u751f\u610f\u3002\u4e2d\u56fd\u4f01\u4e1a\u5230\u5370\u5ea6\u6295\u8d44\uff0c\u65e2\u662f\u4e3a\u4e86\u8d5a\u94b1\uff0c\u4e5f\u7ed9\u5370\u5ea6\u4eba\u6c11\u9020\u798f\u3002\u5bf9\u4e24\u56fd\u5173\u7cfb\u6765\u8bf4\uff0c\u6ca1\u4ec0\u4e48\u6bd4\u7ecf\u6d4e\u5f80\u6765\u66f4\u91cd\u8981\u7684\u7a33\u5b9a\u5668\u4e86\u3002","user":{"id":"00K6R8O5C6SPAIDSTALCF5GJ","nickname":"\u8d75\u60a6\u7136","avatar":"b4314d6dec6690056a9c2fd017270335.jpg"},"article":{"id":"00KDTRSSL6RF5UF49UH0OFYK","cover_url":"de7d8870dad4b28065e43ceadcb1f3d3.jpg","title":"\u4e2d\u56fd\u624b\u673a\u5728\u5370\u5ea6\u4e3a\u4f55\u5b8c\u80dc","description":"\u6253\u538b\u4e2d\u56fd\u624b\u673aAPP\u4e4b\u540e\uff0c\u5370\u5ea6\u6700\u8fd1\u5bf9\u4e2d\u56fd\u4ea7\u54c1\u53c8\u6709\u6240\u9488\u5bf9\u3002\n8\u67081\u65e5\uff0c\u5370\u5ea6\u7535\u5b50\u548c\u4fe1\u606f\u6280\u672f\u90e8\u957f\u8868\u793a\uff0c\u5370\u5ea6\u5c06\u51fa\u53f06","is_deleted":0,"is_shield":0,"created_at":1597381716},"count":{"like":0,"collect":1},"collect_id":"00KI5DM2JPCT6GV8KJ2KSXLK"},{"id":"00KD3XBEWNSE5LLD0BEUATJK","cover_url":"e27f0f13c21ddbddc617ddbcc1dee195.jpg","title":"\u4e2d\u56fd\u5f0f\u5bb6\u5ead\u6559\u80b2\uff1a\u5b69\u5b50\u4e0d\u52aa\u529b\uff0c\u7238\u7238\u4e0d\u51fa\u529b\uff0c\u5988\u5988\u7528\u86ee\u529b\uff0c\u5230\u5934\u6765\u5374\u53ea\u602a\u5b69\u5b50\u662f\u53db\u9006...","description":"\u7236\u4eb2\u4eec\u6700\u6839\u672c\u7684\u7f3a\u70b9\u5728\u4e8e\u60f3\u8981\u81ea\u5df1\u7684\u5b69\u5b50\u4e3a\u81ea\u5df1\u4e89\u5149\u2014\u2014\u7f57\u7d20\u73b0\u5728\u7684\u5bb6\u957f\u90fd\u5f88\u91cd\u89c6\u5b69\u5b50\u7684\u6559\u80b2\u3002\u4ece\u5b69\u5b503\u5c81\u5de6\u53f3\u5f00\u59cb\u5bb6\u957f\u5c31","is_deleted":0,"is_shield":0,"created_at":1606790554,"collect_id":"00KI5DLYNYLOCTB3X7WORDAJ","target_type":1}]},"message":"OK"}
     */
    public function collectList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"total_count":2,"page_size":20,"page":1,"list":[{"id":"00KF3FHQABQOQSU8HQ1HM6ZJ","user_id":"00K6R8O5C6SPAIDSTALCF5GJ","article_id":"00KDTRSSL6RF5UF49UH0OFYK","is_choice":0,"is_deleted":0,"is_public":1,"is_shield":0,"created_at":1606790559,"target_type":2,"content":"\u53ef\u60dc\u8fd1\u6bb5\u65f6\u95f4\u5370\u5ea6\u7684\u79cd\u79cd\u884c\u4e3a\u5145\u5206\u53cd\u6620\u4e86\u4ed6\u4eec\u5e76\u6ca1\u6709\u8fd9\u79cd\u610f\u8bc6","selected":"\u5370\u5ea6\u653f\u5ba2\u8981\u653e\u4e0b\u653f\u6cbb\u6210\u89c1\u548c\u5730\u7f18\u91ce\u5fc3\uff0c\u5fc3\u5e73\u6c14\u548c\u4e0e\u4e2d\u56fd\u4eba\u505a\u751f\u610f\u3002\u4e2d\u56fd\u4f01\u4e1a\u5230\u5370\u5ea6\u6295\u8d44\uff0c\u65e2\u662f\u4e3a\u4e86\u8d5a\u94b1\uff0c\u4e5f\u7ed9\u5370\u5ea6\u4eba\u6c11\u9020\u798f\u3002\u5bf9\u4e24\u56fd\u5173\u7cfb\u6765\u8bf4\uff0c\u6ca1\u4ec0\u4e48\u6bd4\u7ecf\u6d4e\u5f80\u6765\u66f4\u91cd\u8981\u7684\u7a33\u5b9a\u5668\u4e86\u3002","user":{"id":"00K6R8O5C6SPAIDSTALCF5GJ","nickname":"\u8d75\u60a6\u7136","avatar":"b4314d6dec6690056a9c2fd017270335.jpg"},"article":{"id":"00KDTRSSL6RF5UF49UH0OFYK","cover_url":"de7d8870dad4b28065e43ceadcb1f3d3.jpg","title":"\u4e2d\u56fd\u624b\u673a\u5728\u5370\u5ea6\u4e3a\u4f55\u5b8c\u80dc","description":"\u6253\u538b\u4e2d\u56fd\u624b\u673aAPP\u4e4b\u540e\uff0c\u5370\u5ea6\u6700\u8fd1\u5bf9\u4e2d\u56fd\u4ea7\u54c1\u53c8\u6709\u6240\u9488\u5bf9\u3002\n8\u67081\u65e5\uff0c\u5370\u5ea6\u7535\u5b50\u548c\u4fe1\u606f\u6280\u672f\u90e8\u957f\u8868\u793a\uff0c\u5370\u5ea6\u5c06\u51fa\u53f06","is_deleted":0,"is_shield":0,"created_at":1597381716},"count":{"like":0,"collect":1},"collect_id":"00KI5DM2JPCT6GV8KJ2KSXLK"},{"id":"00KD3XBEWNSE5LLD0BEUATJK","cover_url":"e27f0f13c21ddbddc617ddbcc1dee195.jpg","title":"\u4e2d\u56fd\u5f0f\u5bb6\u5ead\u6559\u80b2\uff1a\u5b69\u5b50\u4e0d\u52aa\u529b\uff0c\u7238\u7238\u4e0d\u51fa\u529b\uff0c\u5988\u5988\u7528\u86ee\u529b\uff0c\u5230\u5934\u6765\u5374\u53ea\u602a\u5b69\u5b50\u662f\u53db\u9006...","description":"\u7236\u4eb2\u4eec\u6700\u6839\u672c\u7684\u7f3a\u70b9\u5728\u4e8e\u60f3\u8981\u81ea\u5df1\u7684\u5b69\u5b50\u4e3a\u81ea\u5df1\u4e89\u5149\u2014\u2014\u7f57\u7d20\u73b0\u5728\u7684\u5bb6\u957f\u90fd\u5f88\u91cd\u89c6\u5b69\u5b50\u7684\u6559\u80b2\u3002\u4ece\u5b69\u5b503\u5c81\u5de6\u53f3\u5f00\u59cb\u5bb6\u957f\u5c31","is_deleted":0,"is_shield":0,"created_at":1606790554,"collect_id":"00KI5DLYNYLOCTB3X7WORDAJ","target_type":1}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * noteList
     * @uri /home/note-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"last_id":"8226EEDBE499D0FC"}
     * @response {"success":true,"statusCode":200,"result":{"have_more":false,"list":[{"id":"00KHZCII8WDJR6RBTOCIL0ZS","user_id":"00K5H1KO60NAEIXXDT1SPMMM","article_id":"00KGSTUO1LNFEFGDA5AIYMBX","is_choice":0,"is_deleted":0,"is_public":1,"is_shield":0,"created_at":1606425916,"start_index":12942,"end_index":13301,"content":"\u7b14\u8bb0\u5185\u5bb9","selected":"\u6587\u7ae0\u8282\u9009","is_like":false,"is_collect":false,"user":{"id":"00K5H1KO60NAEIXXDT1SPMMM","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png"},"article":{"id":"00KGSTUO1LNFEFGDA5AIYMBX","cover_url":"6f7822d1a89860a5b85b16ef3154b462.jpg","title":"\u6587\u7ae0\u6807\u9898","description":"\u6587\u7ae0\u63cf\u8ff0","is_deleted":0,"is_shield":0,"created_at":1603854991},"count":{"comment":0,"like":0,"collect":0}}]},"message":"OK"}
     */
    public function noteList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"have_more":false,"list":[{"id":"00KHZCII8WDJR6RBTOCIL0ZS","user_id":"00K5H1KO60NAEIXXDT1SPMMM","article_id":"00KGSTUO1LNFEFGDA5AIYMBX","is_choice":0,"is_deleted":0,"is_public":1,"is_shield":0,"created_at":1606425916,"start_index":12942,"end_index":13301,"content":"\u7b14\u8bb0\u5185\u5bb9","selected":"\u6587\u7ae0\u8282\u9009","is_like":false,"is_collect":false,"user":{"id":"00K5H1KO60NAEIXXDT1SPMMM","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png"},"article":{"id":"00KGSTUO1LNFEFGDA5AIYMBX","cover_url":"6f7822d1a89860a5b85b16ef3154b462.jpg","title":"\u6587\u7ae0\u6807\u9898","description":"\u6587\u7ae0\u63cf\u8ff0","is_deleted":0,"is_shield":0,"created_at":1603854991},"count":{"comment":0,"like":0,"collect":0}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * packageList
     * @uri /home/package-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"last_id":"A3898E8713A05CA2"}
     * @response {"success":true,"statusCode":200,"result":{"have_more":false,"list":[{"id":"00KFNW99P017PBNZGEGGZU6Y","user_id":"00K5H1KO60NAEIXXDT1SPMMM","name":"\u9ed8\u8ba4\u6536\u85cf\u5939","description":"","total":6,"is_default":1,"is_deleted":0,"is_public":1,"updated_at":1606572208},{"id":"00KHZ2RM1B0TSQDSQATGAEPA","user_id":"00K5H1KO60NAEIXXDT1SPMMM","name":"\u79c1\u5bc6\u6536\u85cf\u5939","description":"","total":3,"is_default":1,"is_deleted":0,"is_public":0,"updated_at":1606468389}]},"message":"OK"}
     */
    public function packageList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"have_more":false,"list":[{"id":"00KFNW99P017PBNZGEGGZU6Y","user_id":"00K5H1KO60NAEIXXDT1SPMMM","name":"\u9ed8\u8ba4\u6536\u85cf\u5939","description":"","total":6,"is_default":1,"is_deleted":0,"is_public":1,"updated_at":1606572208},{"id":"00KHZ2RM1B0TSQDSQATGAEPA","user_id":"00K5H1KO60NAEIXXDT1SPMMM","name":"\u79c1\u5bc6\u6536\u85cf\u5939","description":"","total":3,"is_default":1,"is_deleted":0,"is_public":0,"updated_at":1606468389}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}